<h3 class="content-title">
    Thêm quảng cáo
</h3>
<hr/>
<div class="content-center">
    <form action="" method="post" enctype="multipart/form-data" class="span-14">
        <table>
            <tr>
                <td><label>Vị trí:</label></td>
                <td>
                    <select name="postition">
                        <option value="left-top" <?php echo ($node['type']=='left-top')?'selected="selected"':''; ?>>Cột trái - Trên</option>
                        <option value="left-bottom" <?php echo ($node['type']=='left-bottom')?'selected="selected"':''; ?>>Cột trái - Dưới</option>
                        <option value="right-top" <?php echo ($node['type']=='right-top')?'selected="selected"':''; ?>>Cột phải - Trên</option>
                        <option value="right-bottom" <?php echo ($node['type']=='left-bottom')?'selected="selected"':''; ?>>Cột phải - Dưới</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td><label>Upload:</label></td>
                <td>
                    <input id="file_upload" name="file_upload" type="file" />
                    <input type="hidden" name="thumb" id="thumb_src" value="/uploads/no_images_thumb.jpg" />
                    <textarea class="hide" name="description" id="description"><?php echo $node['description'] ?></textarea>
                    <textarea class="hide" name="content" id="content"><?php echo $node['value'] ?></textarea>
                </td>
            </tr>
            <tr>
                <td><label>Tiêu đề:</label></td>
                <td><input type="text" name="title" class="text" value="<?php echo $node['title']; ?>"/></td>
            </tr>
            <tr>
                <td><label>Link:</label></td>
                <td><input type="text" name="link" class="text" value="<?php echo $node['link']; ?>"/></td>
            </tr>
            <tr>
                <td><label>Hiển thị:</label></td>
                <td><input type="checkbox" name="status" value="1" <?php echo ($node['status']==1)?'checked="checked"':''; ?>/><br/><br/></td>
            </tr>
            <tr>
                <td>
                    <input type="hidden" name="category_id" value="29"/>
                    <input type="hidden" name="node_id" value="<?php echo $node['node_id']; ?>" />
                </td>
                <td><input type="submit" name="update" value="Hoàn tất" class="button"></td>
            </tr>
        </table>
    </form>
    <div id="demo" class="span-5 last" style="padding-left: 20px;border-left:1px solid #CCC; min-height: 200px">
        <?php echo $node['value']; ?>
    </div>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>static/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/uploadify/swfobject.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/nicEdit/nicEdit.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $('#file_upload').uploadify({
        'uploader'  : config.baseUrl + 'static/uploadify/uploadify.swf',
        'script'    : config.baseUrl + 'static/uploadify/uploadify.php',
        'cancelImg' : config.baseUrl + 'static/uploadify/cancel.png',
        'folder'    : '/uploads/',
        'auto'      : true,
        'multi'     : false,
        'fileExt'   : '*.jpg;*.jpeg;*.png;*.gif;*.swf',
        onComplete  : function(event, queueID, fileObj, response, data){
            
            //Parse json
            response = JSON.parse(response);
            
            var domHTML;
            
            //Check type
            if(fileObj.type == '.swf')
            {
                domHTML = $('<object></object>');
                domHTML.append('<param name="allowScriptAccess" value="always" />')
                       .append('<param name="quality" value="high" />')
                       .append('<param name="wmode" value="transparent" />')
                       .append('<param name="movie" value="'+ response.src +'" />')
                       .append('<embed width="'+ response.width +'" height="'+ response.height +'" src="'+ response.src +'"></embed>')
                       .attr('width', response.width)
                       .attr('height', response.height);
            }
            else
            {
                domHTML = $('<img/>');
                domHTML.attr('src', response.src)
                       .attr('width', response.width)
                       .attr('height', response.height);
            }
            
            //Append HTML
            $('#demo').html(domHTML);
            
            //Append Content
            $('#description').text(document.getElementById('demo').innerHTML);
            $('#content').text(document.getElementById('demo').innerHTML);
        }
    });
});
</script>